<?php
namespace app\admin\validate;
use think\Validate;

class User extends Validate
{
    
    protected $rule = [
        'username'      =>  'require',
        'password'      =>  'require',
        'userid'        =>  'require',
        'method'        =>  'require|in:editPictureNum',
        'pictureNum'    =>  'require|number',
    ];

    protected $message = [
        'username.require'  => '用户名不能为空!',
        'password.require'  => '密码不能为空!',
        'userid.require'    => '用户ID参数不能为空!',
        'method.require'    => '操作方法参数不能为空!',
        'method.in'         => '操作方法参数错误!',
        'pictureNum.require'    => '生成图片次数参数不能为空!',
        'pictureNum.number'     => '生成图片次数参数错误!',
    ];

    protected $scene = [
        'login'             =>  ['username','password'],
        'editBefore'        =>  ['method'],
        'editPictureNum'    =>  ['userid','pictureNum'],
    ];

}